<?php
/**
 * @author Thibaut Cromphaut, Gaïtano Boeraeve, Mathias Helin, Dimitry Dierickx
 * @copyright  Copyright (c) 2011 Artevelde University College Ghent 
 */

class Application_Form_Element_BookSelect extends Zend_Form_Element_Select
{
    public function init()
    {
        // Load the mapper and fetch all options
        $mapper  = new Application_Model_BookMapper();
        $results = $mapper->fetchAll();
        
        // Add default option
        $this->addMultiOption('', 'Select a book');
        
        // Add the other options
        foreach ($results as $object)
            $this->addMultiOption($object->Id, $object->Title);
    }
}